<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.listForm.weiShengJu"/><spring:message code="message.jieSuan.zhiFuDan"/> <spring:message code="message.jieSuan.yiLiaoJiGouFenZu"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.listForm.weiShengJu"/><spring:message code="message.jieSuan.zhiFuDan"/></h1>
         <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.jieSuan.zhiFuDanGuanLi"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.listForm.weiShengJu"/><spring:message code="message.jieSuan.zhiFuDanGuanLi"/></a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success ">
            	<table class="jqgrid" id="firstGridlist"></table> 
            	<div id="firstGridpage"></div>
                </div>
                 <div class=" box box-success ">
                <table class="jqgrid" id="secondGridlist"></table>
                <div id="gridpage"></div>
        </div>
         <div class="box-footer text-center">
                    <a href="${ctx }/centerCheckPayment/toPaymentByComp.html" class="btn btn-default btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
                </div>
    </section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
    $(function(){
		$("#firstGridlist").jqGrid(
				{   url : "getPaymentByHospList.html",
					mtype : "POST",
					postData:{"setCenterId":"${setCenterId}","paymentBillId":"${paymentBillId}","compId":"${compId}"},
					datatype : "json",
					height :270,
					colNames : [
					            '<spring:message code="message.jieSuan.zhiFuDanMingXi"/>id',
					            '<spring:message code="message.model.peiSongQiYe"/>ID',
					            '<spring:message code="message.listForm.weiShengJu"/>ID',
					            '<spring:message code="message.listForm.yiLiaoJiGou"/>ID',
					            '<spring:message code="message.listForm.yiLiaoJiGouBianMa"/>',
					            '<spring:message code="message.listForm.yiLiaoJiGouMingCheng"/>',
					            '<spring:message code="message.listForm.suoShuDiQu"/>',
					            '<spring:message code="message.jieSuan.zhiFuYaoPinShu"/>',
					            '<spring:message code="message.jieSuan.zhiFuZongJinE"/>',
					            '<spring:message code="message.jieSuan.zhangHuYuE"/>'
					            ],
					colModel : [
								{name : 'paymentBillId',index : 'paymentBillId', hidden : true,width : 160,align : "center",sortable:false},
								{name : 'compId',index : 'compId', hidden : true,width : 160,align : "center",sortable:false},
								{name : 'setCenterId',index : 'settlementId', hidden : true,width : 160,align : "center",sortable:false},
								{name : 'hospId',index : 'hospId', hidden : true,width : 160,align : "center",sortable:false},
								{name : 'hospCode',index : 'hospCode', width : 100,align : "center",sortable:false},
								{name : 'hospName',index : 'hospName', width : 160,align : "left",sortable:false},
								{name : 'areaName',index : 'areaName', width : 120,align : "center",sortable:false},
								{name : 'totalDrugs',index : 'totalDrugs', width : 120,align : "center",sortable:false,
										formatter:function(cellvalue, options, row){
										return "<a href='javascript:totalHosp(\""+row.hospId+"\",\""+row.setCenterId+"\",\""+row.paymentBillId+"\",\""+row.compId+"\");'>"+cellvalue+"</a>";
									}
								},
								{name : 'pendingAmt',index : 'pendingAmt', width : 80,align : "right",sortable:false,
									formatter:function(cellvalue, options, row){
										return formatAmount(cellvalue, options, row);
									}
								},
								{name : 'outstandAmt',index : 'outstandAmt', width : 80,align : "right",sortable:false,
									formatter:function(cellvalue, options, row){
										return formatAmount(cellvalue, options, row);
									}
								}
					],
					rownumbers : true,
					pager : "#firstGridpage",
					viewrecords : true,
					caption : "<spring:message code="message.jieSuan.yiLiaoJiGouFenZu"/><spring:message code="message.listForm.lieBiao"/>",
					//序号宽度自动变化
	                gridComplete:function(){
	                    //序号列宽度自适应（参数为jqgridID）
	                    autoRNWidth("firstGridlist");
	                    //数据只有一条时默认选中（参数为jqgridID）
	                    selectByOneData("firstGridlist");
	                },
					jsonReader : {
						repeatitems : false,
						id : "ids"
					}
				});
		$("#firstGridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
		
		$("#secondGridlist").jqGrid(
				{   url : "getSettletdetailinfoByHospList.html",
					mtype : "POST",
					datatype : "json",
					hiddengrid: false,
					height : 180,
					colNames : [
					            '<spring:message code="message.listForm.yaoPinBianMa"/>',
					            '<spring:message code="message.listForm.tongYongMing"/>',
					            '<spring:message code="message.listForm.jiXing"/>',
					            '<spring:message code="message.listForm.guiGe"/>',
					            '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
					            '<spring:message code="message.listForm.baoZhuangDanWei"/>',
					            '<spring:message code="message.listForm.caiZhi"/>',
					            '<spring:message code="message.listForm.shengChanQiYe"/>',
					            '<spring:message code="message.jieSuan.caiGouShuLiang"/>',
					            '<spring:message code="message.listForm.CaiGouJinE"/>',
					            '<spring:message code="message.jieSuan.zhiFuLeiXing"/>'
					            ],
					colModel : [
								{name : 'drugCode',index : 'drugCode', hidden : true,width : 160,align : "center",sortable:false},
								{name : 'drugName',index : 'drugName', width : 140,align : "left",sortable:false},
								{name : 'formName',index : 'formName', width : 80,align : "center",sortable:false},
								{name : 'specName',index : 'specName', width : 80,align : "left",sortable:false},
								{name : 'factor',index : 'factor', width : 80,align : "center",sortable:false},
								{name : 'unit',index : 'unit', width : 40,align : "center",sortable:false},
								{name : 'materialName',index : 'meterialName', width : 80,align : "center",sortable:false},
								{name : 'prodName',index : 'peoName', width : 180,align : "left",sortable:false},
								{name : 'proCount',index : 'peoCount', width : 80,align : "center",sortable:false},
								{name : 'proPrice',index : 'proPricr', width : 80,align : "right",sortable:false,
									formatter:function(cellvalue, options, row){
										return formatAmount(cellvalue, options, row);
									}
								},
								{name : 'bankAcctTransType',index : 'bankAcctTransType', width : 80,align : "center",sortable:false,
									formatter:function(cellvalue, options, row){
										var temp ='';
										if (cellvalue==1) {temp = "<spring:message code="message.jieSuan.caiGouLei"/>";}
										else if (cellvalue==2) {temp = "<spring:message code="message.jieSuan.tuiHuoLei"/>";}
										else{temp ='<spring:message code="message.listForm.qiTa"/>';}
										return temp;
									}
								}
					],
					rownumbers : true,
					pager : "#gridpage",
					viewrecords : true,
					caption : "<spring:message code="message.jieSuan.yaoPinFenZu"/><spring:message code="message.listForm.lieBiao"/>",
					//序号宽度自动变化
	                gridComplete:function(){
	                    //序号列宽度自适应（参数为jqgridID）
	                    autoRNWidth("secondGridlist");
	                    //数据只有一条时默认选中（参数为jqgridID）
	                    selectByOneData("secondGridlist");
	                },
					jsonReader : {
						repeatitems : false,
						id : "ids"
					}
				});
		$("#secondGridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
		$(window).trigger("resize");
    });
    
    
    function totalHosp(hospId,setCenterId,paymentBillId,compId){
	        $("#secondGridlist").jqGrid('setGridParam',{
                datatype:'json',
                postData:{
                	'hospId':hospId,
                	'setCenterId':setCenterId,
                	'paymentBillId':paymentBillId,
                	'compId':compId
                	},
                page : 1
            }).trigger("reloadGrid"); 
    }
    
  
 </script>
</body>
</html>